﻿<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>卖车 - 锐车</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta content="锐车" name="keywords" />
	<meta content="锐车" name="description" />
    <link rel="stylesheet" href="/static/layui/css/layui.css">
	<link rel="stylesheet" type="text/css" href="/static/home/Css/style.css">
	<script type="text/javascript" src="/static/home/Scripts/jquery.js"></script>
	<script type="text/javascript" src="/static/home/Scripts/jquery.form.js"></script>
	<script type="text/javascript" src="/static/layui/layui.js"></script>
	<script type="text/javascript" src="/static/home/Scripts/common.js"></script>
	<script type="text/javascript">
		//一般直接写在一个js文件中
		layui.use(['layer'], function(){
			var layer = layui.layer;
			
		});
		
		//品牌选择
		layui.use('form', function(){
			var form = layui.form;
			form.on('select(brand)', function(data){
				$.get("/index.php?m=ajax&ajax=1", { 
					brandid :  $("select[name=p_brand]").val() 
				}, function (data, textStatus){
					   $("#subbrand").html(data);
					   form.render('select');
					}
				);
			});
			form.on('select(subbrand)', function(data){
				$.get("/index.php?m=ajax&ajax=1", { 
					subbrandid :  $("select[name=p_subbrand]").val() 
				}, function (data, textStatus){
					   $("#subsubbrand").html(data);
					   form.render('select');
					}
				);
			});

			form.on('select(province)', function(data){
				$.get("/index.php?m=ajax&ajax=1",{ 
					provid :  $("select[name=aid]").val() 
				}, function (data, textStatus){
					   $("#city").html(data);
					   form.render('select');
					}
				);
			});
		});
		//表单提交
		$(function () {
			var ajax_option={ 
				success:function(data){
					var result = $.parseJSON(data);
					if(result.code==1){
						//layer.msg(result.msg, {time: 1000, icon: 1});
						$('#ajaxForm')[0].reset();
						layer.open({
							type: 1, 
							closeBtn:1,
							title:'',
							shadeClose:true,
							area: ['600px', '330px'],
							content: '<div class="sellres"><p class="sellicon"><i class="layui-icon">&#xe6af;</i></p><p class="sellmsg">您的卖车信息已经提交成功，稍候我们的客服会联系您，请耐心等待！</p><p class="selltel">可拨打客服电话：<span>010-58480317</span></p></div>'
						});

						//setTimeout(function(){//两秒后跳转   
						//	location.href = result.url; 
						//},1000);
					}
					else{
						layer.msg(result.msg, {time: 1000, icon: 2});
					}
				}
			};  
			$("#ajaxForm").submit(function () {
				$(this).ajaxSubmit(ajax_option);
				return false;
			});
		});
	</script>
	</head>
	<body>
	<script language="JavaScript">
$(function(){
	$(".nav_all_types").hover(function(){
		$(".show_all_types .layui-icon").html("&#xe619;");
		$(".all_types_box").show();
	},function(){
		$(".show_all_types .layui-icon").html("&#xe61a;");
		$(".all_types_box").hide();
	});

	//城市选择
	$(".citymark a").click(function() {
		var mark = $(this).attr("dataid");
		var citytop = $(".city-list").scrollTop()+$("#"+mark).position().top - 50;
		$(".city-list").animate({
			scrollTop: citytop
		}, {duration: 500, easing: "swing"});
		return false;
	});

	$(".selectcity").click(function(event) {
		if($(".citylist-box").is(":hidden")){
			$(this).addClass("whitebg");
			$(".selectcity .layui-icon").html("&#xe619;");
			$(".citylist-box").removeClass("layui-hide");
		}
		else{
			$(this).removeClass("whitebg");
			$(".selectcity .layui-icon").html("&#xe61a;");
			$(".citylist-box").addClass("layui-hide");
		}
		event.stopPropagation();//这句是必须
	});


	$(document).bind("click",function(e){
		var target  = $(e.target);
		if(target.closest(".citylist-box").length == 0){
			$('.selectcity').removeClass("whitebg");
			$(".selectcity .layui-icon").html("&#xe61a;");
			$(".citylist-box").addClass("layui-hide");
		}
		e.stopPropagation();
	});

	$(".changecity").click(function() {
		var city = $(this).attr("data");
		$.ajax({
			url: "/index.php?m=ajax&ajax=1&changecity=1",
			data:{city:city},
			type: "get",
			dataType: "json",
			success: function(data){
				if(data.status == 'y'){
					window.location.reload();
				}
			}
		});
	});
})
</script>
<!--头部-->
	{include file="public/head"  title='首页'/}

<!--<div class="layui-container layui-breadcrumb-nav">
		<span class="layui-breadcrumb">
		  <a href="/">首页</a>
		  <a><cite>卖车</cite></a>
		</span>
	</div>-->
	<div class="sellbg">
		<div class="sellcar">
			<div class="title">我要卖车</div>
			<form class="layui-form" method="post" action="/sellcar/" id="ajaxForm">
				<div class="layui-form-item">
					<select name="pid" lay-search lay-filter="pid"  lay-verify="required">
						{foreach $area as $v}
		                    <option value="{$v['id']}">{$v['first']}  {$v['name']}</option>
		                {/foreach}
					</select>
				</div>
				<div class="layui-form-item">
					<select name="aid" lay-search id="aid"  lay-verify="required" lay-filter="aid">
						{foreach $area2 as $v}
		                    <option value="{$v['id']}">{$v['first']}  {$v['name']}</option>
		                {/foreach}
					</select>
				</div>
				<div class="layui-form-item">
					<select name="bid" lay-verify="" lay-filter='bid'>
	                  {foreach $brand as $v}
	                    <option value="{$v['bid']}">{$v['first']}  {$v['bname']}</option>
	                  {/foreach}
	                </select>
				</div>
				<div class="layui-form-item">
					<select name="cid" lay-verify="" lay-filter='cid'>
                  
                	</select> 
				</div>
				<div class="layui-form-item">
					<select name="tid" lay-verify="" lay-filter='tid'>
                  
                	</select> 
				</div>
				<div class="layui-form-item">
					<input type="text" name="ophone" lay-verify="required|phone" placeholder="请输入手机号码" class="layui-input">
				</div>
				<div class="layui-form-item">
					<input type="hidden" name="a" value="sell">
					<button class="layui-btn layui-btn-fluid layui-btn-danger" lay-submit=""  lay-filter="add" id="add">提交</button>
				</div>
			</form>
		</div>
	</div>
	<div class="sell_step">
		<div class="layui-container">
			<ul class="layui-clear">
				<li class="sell_step_1">
					<p class="title">发布信息</p>
					<p class="info">一键提交信息</p>
				</li>
				<li class="sell_step_2">
					<p class="title">上门检测</p>
					<p class="info">评估完全免费</p>
				</li>
				<li class="sell_step_3">
					<p class="title">买家看车</p>
					<p class="info">买家上门看车</p>
				</li>
				<li class="sell_step_4">
					<p class="title">交易过户</p>
					<p class="info">锐车全程代办</p>
				</li>
			</ul>
		</div>
	</div>
	<div class="layui-container">
		<div class="ask-box">
			<h3 class="title">常见问题</h3>
			<ul class="layui-clear">
							</ul>
		</div>
	</div>
	<div class="service-box">
	<div class="layui-container layui-clear">
		<div class="service-box-item first">
			<h3>售后服务电话</h3>
			<ul>
				<li><span class="tel">010-58480317</span></li>						
				<li>phpstat@phpstat.net</li>
			</ul>
		</div>
		<div class="service-box-item">
			<h3>买车宝典</h3>
			<ul>
				<li><a href="/news/1/1">车况鉴别</a></li>
				<li><a href="/news/2/1">选车技巧</a></li>
				<li><a href="/news/21/1">过户缴费</a></li>
			</ul>
		</div>
		<div class="service-box-item">
			<h3>客服中心</h3>
			<ul>
				<li><a href="/about/3">网站合作</a></li>
				<li><a href="/about/4">联系我们</a></li>
			</ul>
		</div>
		<div class="service-box-item">
			<h3>意见反馈</h3>
			<ul>
				<li><a href="/feedback/">投诉与建议</a></li>
			</ul>
		</div>
		<div class="service-box-item">
			<h3>联系我们</h3>
			<ul>
				<li><a href="/about/1">关于我们</a></li>
				<li><a href="/about/2">人才招聘</a></li>
			</ul>
		</div>
	</div>
</div>
<div class="foot-box mt20">
	<div class="layui-container">
		<p class="copyright">锐车   免费咨询：010-58480317</p>
		<p class="copyright"> Copyright 2018 锐车 版权所有. 锐车11111</p>
	</div>
</div>
	</body>
	<script type="text/javascript">
		layui.use(['form','layer'], function(){
			 var form = layui.form;
			 var layer = layui.layer;
			 //监听提交
	          form.on('submit(add)', function(data){
	            
	            $.ajax({
                  type: 'POST',
                  url: "{:url('home/home/sellcar')}",
                  data:$('form').serialize(),
                  traditional:true,
                  success: function(data){
                      if(data.code==1){
                        layer.msg(data.msg,{icon:1,time:1000},function(){
                            window.location.href="/";
                        });
                      }else{
                        layer.msg(data.msg,{icon:2,time:1000},function(){

                        });
                      }
                  }
                });
	            return false;
	          });
			//地区联动
	         form.on('select(pid)', function(data){
	            $.ajax({
	                type: 'GET',
	                url: "{:url('home/home/sellcar')}",
	                data:"pid="+data.value,
	                success: function(data){
	                  str = '';
	                  for(i in data){
	                    str+="<option value='"+data[i].id+"'>"+data[i].first+" "+data[i].name+"</option>"
	                  }
	                  $("select[name='aid']").html(str);
	                  form.render();
	                }
	            });
	          });
	         //品牌联动
	         form.on('select(bid)', function(data){
	            $.ajax({
	                type: 'GET',
	                url: "{:url('home/home/sellcar')}",
	                data:"bid="+data.value,
	                success: function(data){
	                  str = '';
	                  for(i in data.gname){
	                    str+="<option value='0' disabled>----"+data.gname[i].gname+"----</option>";
	                    for(k in data.cate){
	                      if(data.cate[k].gname == data.gname[i].gname){
	                        str+="<option value='"+data.cate[k].id+"'>"+data.cate[k].name+"</option>";
	                      }
	                    }
	                  }
	                  $("select[name='cid']").html(str);
	                  ssr = '';
	                  for(a in data.type){
	                    ssr+="<option value='"+data.type[a].tid+"'>"+data.type[a].tname+"</option>";
	                  }
	                  $("select[name='tid']").html(ssr);
	                  form.render();
	                }
	            });
	          });
	          form.on('select(cid)', function(data){
	            $.ajax({
	                type: 'GET',
	                url: "{:url('home/home/sellcar')}",
	                data:"cid="+data.value,
	                success: function(data){
	                  str = '';
	                  for(i in data){
	                    str+="<option value='"+data[i]['tid']+"'>"+data[i]['tname']+"</option>";
	                  }
	                  $("select[name='tid']").html(str);
	                  form.render();
	                }
	            });
	          });
		})
	</script>
</html>